package com.edu.service.impl;

import com.edu.bean.Book;
import com.edu.mapper.BookMapper;
import com.edu.service.BookService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class BookServiceImpl implements BookService {
    @Resource
    private BookMapper bookMapper;
    @Override
    public List<Book> findAllBook() {
        List<Book> books = bookMapper.selectAllBook();
        return books;
    }

    @Override
    public int deleteBook(int bookId) {
        int i = bookMapper.deleteBookById(bookId);
        return i;
    }

    @Override
    public int updateBook(Book book) {
        int i = bookMapper.updateBook(book);
        return i;
    }

    @Override
    public Book selectOneBook(int bookId) {
        Book book = bookMapper.selectOneBook(bookId);
        return book;
    }

    @Override
    public List<Book> searchBook(String keyword) {
        List<Book> books = bookMapper.selectBookByKeyWord(keyword);
        return books;
    }
}
